﻿@{
    ViewBag.Title = "Uploader";
    Layout = "~/Views/Shared/_Uploader.cshtml";
}
@section Content {
    <script>

        $(function () {
            $.ajax({
                url: "/OrderFlowManage/ClientOrder/GetToken",
                data: {},
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#token").val(data.token);
                }
            });
        });

        function submitForm() {
            console.log("666");
            if (!$('#testform').formValid()) {
                return false;
            }

            var parentId = 'editForm',
                selfId = 'ArticleUploader',
                userfile = $("#userfile").val(),
                filePath = $("#userfilepath").val(),
                fileName = $("#userfilename").val();
            debugger
            top.frames[parentId].settingImage(filePath);
            $.loading(false);
            $.modalFrameClose(selfId);
        }
    </script>
}

<div style="padding-top: 20px; margin-right: 20px;">
    <div class="container">
        <!-- Document：https://developer.qiniu.com/kodo/manual/form-upload -->
        <form id="testform" method="post" enctype="multipart/form-data">
            <table class="form">
                <tr>
                    <th class="formTitle">选择图片</th>
                    <td class="formValue" colspan="3">
                        <input name="key" id="key" type="hidden" value="">
                        <input id="token" name="token" type="hidden" value="">
                        <input id="userfile" name="file" type="file" class="form-control required" />
                        <input id="userfilepath" name="userfilepath" type="hidden" />
                        <input id="userfilename" name="userfilepath" type="hidden" />

                        <!-- take photo with phone -->
                        <!-- <input id="userfile" name="file" accept="image/*" type="file" /> -->
                        <!-- take video with phone -->
                        <!-- <input id="userfile" name="file" type="file" accept="video/*"/> -->
                        <input name="accept" type="hidden" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">操作描述</th>
                    <td class="formValue" colspan="3">
                        <!-- upload info -->
                        <div class="selected-file"></div>
                        <div class="progress"></div>
                        <div class="uploaded-result"></div>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>


